package com.liezh.bridge.local;

import com.liezh.bridge.FileUploadExcutor;
import com.liezh.bridge.FileUploader;

/**
 * @author liezh
 * @date 2021-9-2
 */
public class LoaclFileUploaderImpl implements FileUploader {
    FileUploadExcutor excutor = null;

    public LoaclFileUploaderImpl(FileUploadExcutor excutor) {
        this.excutor = excutor;
    }

    @Override
    public Object upload(String path, Object file) {
        assert !check(file) : new RuntimeException("文件校验不通过");
        return excutor.uploadFile(path, file);
    }

    @Override
    public boolean check(Object file) {
        return excutor.checkFile(file);
    }

    public boolean delete(String key) {
        return excutor.delete(key);
    }
}
